﻿@model InShare.Model.TagEntity

@{
    ViewBag.Title = "标签编辑";
    Layout = "~/Areas/Manage/Views/Shared/_Layout.cshtml";
}
<form id="formEdit">
    <input type="hidden" name="Id" value="@Model.Id" />
    <div class="row cl">
        <label class="form-label col-3"><span class="c-red">*</span>名称：</label>
        <div class="formControls col-5">
            <input type="text" class="input-text" name="Name" value="@Model.Name" id="Name" datatype="*2-50" nullmsg="名称不能为空" />
        </div>
        <div class="col-4"> </div>
    </div>
    <input type="button" value="修改" id="btnSave" />
</form>

@section FooterScript
{
    <script type="text/javascript">
        var saveAjax = function () {
            var formData = $("#formEdit").serializeArray();
            $.ajax({
                url: "/Manage/Tag/Edit",
                type: "post",
                data:formData,
                dataType: "json",
                success: function (res) {
                    if(res.Status=="OK")
                    {
                        parent.location.reload();//刷新父窗口
                    }
                    else
                    {
                        alert(res.ErrorMsg);
                    }
                },
                error: function () { alert("请求出错"); }
            });
        };
        $(function () {
            var validForm = $("#formEdit").Validform({ tiptype: 2 });
            $("#btnSave").click(function () {
                if (validForm.check(false))
                {
                    saveAjax();
                }
            });
            @*$("#phoneNum").blur(function () {
                var phoneNum = $(this).val();
                if (phoneNum.length <= 0) return;
                $.ajax({
                    url: "/AdminUser/CheckPhoneNum", dataType: "json", type: "post",
                    data: { phoneNum: phoneNum,userId:@Model.Id },
                    success:function(res)
                    {
                        if (res.Status == "exists")
                        {
                            layer.msg('这个手机号已经被其他人使用了!', { icon: 2, time: 2000 });
                        }
                    },
                    error:function()
                    {
                        alert("网络通讯错误");
                    }
                });
            });*@
        });
    </script>
}